
/**
 * @properties={typeid:24,uuid:"502A21DF-9E4E-45B0-9E52-A843FF8F9579"}
 * @AllowToRunInFind
 */
function autenticar(user,pass) {

	/**@type {JSFoundSet<db:/fwk_navigation_infocom/uservs>} */
	var fs = databaseManager.getFoundSet('fwk_navigation_infocom','uservs')
	fs.find()
	fs.login_nombre = user
	var $cant = fs.search()
	if ($cant == 1)
	{
		if (fs.hash_password == utils.stringMD5HashBase64(pass))
		{
			databaseManager.addTableFilterParam('fwk_navigation_infocom',null ,'userv_id','=',fs.userv_id,'USERV')
			var g = new Array('USERVS')
			if (security.login(user, fs.userv_id, g) == false)
			{
//				Permiso denegado
				return 2
			}
			return 1
		}
		else
		{
//			Contraseña incorrecta
			security.logout()
			return 3
		}
	}
	else
	{	
//		Usuario no existe
		security.logout()
		return 4
	}
}
